//jQuery 插件



/**
 * 新建、修改cookie
 * example  $.cookie('name', 'value')
 * 新建cookie 包括有效期 路径 域名等
 * example $.cookie('name', ‘value', {expires: 7, path: ‘/', domain: ‘jquery.com', secure: true});
 * 删除cookie 
 * example $.cookie('name', null);
*/
(function($) {
    $.cookie = function(name, value, options) {
        if (typeof value != 'undefined') {
            options = options || {};
            if (value === null) {
                value = '';
                options.expires = -1
            };
            var expires = '';
            if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
                var date;
                if (typeof options.expires == 'number') {
                    date = new Date();
                    date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000))
                } else {
                    date = options.expires
                };
                expires = '; expires=' + date.toUTCString()
            };
            var path = options.path ? '; path=' + (options.path) : '';
            var domain = options.domain ? '; domain=' + (options.domain) : '';
            var secure = options.secure ? '; secure': '';
            document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('')
        } else {
            var cookieValue = null;
            if (document.cookie && document.cookie != '') {
                var cookies = document.cookie.split(';');
                for (var i = 0; i < cookies.length; i++) {
                    var cookie = jQuery.trim(cookies[i]);
                    if (cookie.substring(0, name.length + 1) == (name + '=')) {
                        cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                        break
                    }
                }
            };
            return cookieValue
        }
    };
})(jQuery);


/**
 * ie6实现position:fixed
 * example:  
   $("div").ieFixed({
	 x:100,
	 y:100
   })
*/
(function($) {
    $.fn.ieFixed = function(options) {
		var opts = $.extend({
            x: 0,
            y: 0
        }, options),
		isIe6 = ($.browser.msie && parseInt($.browser.version) == 6)?true:false;
        if (isIe6) {
			var $html =  $("html");
			($html.css("backgroundAttachment") !== "fixed") && ($html.css("backgroundAttachment", "fixed"));
			($html.css("backgroundImage")=="none") && ($html.css("backgroundImage", "url(about:blank)"));
        };
        return this.each(function() {
			var $this = $(this),_this = this;
			if (isIe6){
				$this.css("position", "absolute");
				_this.style.setExpression("left", 'eval(document.documentElement.scrollLeft + ' + opts.x + ') + "px"');
				_this.style.setExpression("top", 'eval(document.documentElement.scrollTop + ' + opts.y + ') + "px"');
			}else{
				$this.css("position", "fixed").css("top", opts.y).css("left", opts.x)
			};
        });
    };
})(jQuery);


/**
 * lazyload 图片延迟加载
 * example:  
	$(".lazyload").lazyload({
        effect: "fadeIn",
        failurelimit: 50,
        threshold: 400
    });
*/
(function($) {
    $.fn.lazyload = function(options) {
        var settings = {
            threshold: 0,
            failurelimit: 0,
            event: "scroll",
            effect: "show",
            container: window
        };
        if (options) {
            $.extend(settings, options)
        };
        var elements = this;
        if ("scroll" == settings.event) {
            $(settings.container).bind("scroll",
            function(event) {
                var counter = 0;
                elements.each(function() {
                    if ($.abovethetop(this, settings) || $.leftofbegin(this, settings)) {} else if (!$.belowthefold(this, settings) && !$.rightoffold(this, settings)) {
                        $(this).trigger("appear")
                    } else {
                        if (counter++>settings.failurelimit) {
                            return false
                        }
                    }
                });
                var temp = $.grep(elements,
                function(element) {
                    return ! element.loaded
                });
                elements = $(temp)
            })
        };
        this.each(function() {
            var self = this;
            $(self).one("appear",
            function() {
                if (!this.loaded) {
                    $("<img />").bind("load",
                    function() {
                        $(self).hide().attr("src", $(self).attr("original"))[settings.effect](settings.effectspeed);
                        self.loaded = true
                    }).attr("src", $(self).attr("original"))
                }
            });
            if ("scroll" != settings.event) {
                $(self).bind(settings.event,
                function(event) {
                    if (!self.loaded) {
                        $(self).trigger("appear")
                    }
                })
            }
        });
        $(settings.container).trigger(settings.event);
        return this
    };
    $.belowthefold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).height() + $(window).scrollTop()
        } else {
            var fold = $(settings.container).offset().top + $(settings.container).height()
        };
        return fold <= $(element).offset().top - settings.threshold
    };
    $.rightoffold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).width() + $(window).scrollLeft()
        } else {
            var fold = $(settings.container).offset().left + $(settings.container).width()
        };
        return fold <= $(element).offset().left - settings.threshold
    };
    $.abovethetop = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).scrollTop()
        } else {
            var fold = $(settings.container).offset().top
        };
        return fold >= $(element).offset().top + settings.threshold + $(element).height()
    };
    $.leftofbegin = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).scrollLeft()
        } else {
            var fold = $(settings.container).offset().left
        };
        return fold >= $(element).offset().left + settings.threshold + $(element).width()
    };
    $.extend($.expr[':'], {
        "below-the-fold": "$.belowthefold(a, {threshold : 0, container: window})",
        "above-the-fold": "!$.belowthefold(a, {threshold : 0, container: window})",
        "right-of-fold": "$.rightoffold(a, {threshold : 0, container: window})",
        "left-of-fold": "!$.rightoffold(a, {threshold : 0, container: window})"
    })
})(jQuery);


/**
 * 选项卡
 * example: 
 	$("").wowoTab({
		boxList : $(""), //对应的box
		index:2, //默认索引
		style:"" //tab切换样式
	});
*/
(function($){
	$.fn.wowoTab = function (options){
		var $this = this,
			opts = $.extend({
				boxList : null,
				evt : "mouseover",
				index : 0,
				style:""
			}, options);	
		if (opts.boxList==null) return;
		if (opts.index > this.length-1 || opts.index < 0 ) opts.index = 0;
		//初始化
		if (opts.index != 0){
			$this.removeClass(opts.style);
			$this.eq(opts.index).addClass(opts.style);
			opts.boxList.hide();
			opts.boxList.eq(opts.index).show();
		};
		//注册
		$this.on(opts.evt,function(){				
			var that = $(this) , index = that.index();
			$this.removeClass(opts.style);
			opts.boxList.hide();
			$this.eq(index).addClass(opts.style);
			opts.boxList.eq(index).show();
		});
	};
})(jQuery)

/**
 * 缓动的动画
*/
jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/**
 * 广告轮播插件
 * example: 
 	$("#wowoFocus").wowoFocus({
		pic:$("#pic"),
		picList:$("#pic>li"),
		num:$("#num"),
		closeBut:$("#wowoFocusCloseBut"),
		easing:"easeOutCubic"
	});
*/
(function($){
	$.fn.wowoFocus = function(options){
		var opts = $.extend({
			width:958,//默认宽度
			height:88,//默认高度
			triggerTime:200,//事件触发时间
			moveTime:3000,//循环移动时间间隔
			runtime:300,//动画执行时间
			startNum:0,//默认起始位置(0开始)
			loadTime:5000,
			evn:"mouseenter", //触发事件mouseenter click
			easing:"",//动画效果
			pic:null,
			picList:null,
			closeBut:null,
			num:null
		}, options);
		var _private = {
			len:function(i){//列表长度
				return i = (i<opts.picList.length && opts.startNum>=0)?i:0;
			},
			numHtml : function(i){//默认载入的html
				opts.startNum = (opts.startNum<opts.picList.length && opts.startNum>=0)?opts.startNum:0;
				for (var i = 0, len = opts.picList.length, numStr=i, numHtml = ""; i < len; i++){
					numStr +=1;
					if (opts.startNum == i){
						numHtml += "<li class=\"focus\"> <span></span> <a>"+numStr+"</a> </li>";
					}else{
						numHtml += "<li> <span></span> <a>"+numStr+"</a> </li>";
					};
				};
				return numHtml;
			},
			imgLoad:function (imglist,callback,time){//图片载入完成
				var i=0,j=0,len = imglist.length;
				imglist.each(function(){
					var _this = this;
					var imgLoad = new Image();
					imgLoad.onload = function(){
						imgLoad.onload = null;
						_this.src = imgLoad.src;
						i++;
					};
					imgLoad.src = _this.src;
				});
				var t = window.setInterval(function(){
					j++;
					//$("#msg").html(i);
					if (i==len || j*200>=time){
						window.clearInterval(t);
						callback();
					};
				},200);
			},
			move:function(i){//滚动
				this.t = window.setTimeout(function(){
					opts.num.find("li").eq(opts.startNum).removeClass("focus");
					opts.num.find("li").eq(i).addClass("focus");
					opts.startNum = i;
					if(opts.picList.find("img").css("width")>"500px"){
									opts.pic.animate({
									top:-i*opts.height
								},{
									duration:opts.runtime,
									easing: opts.easing
								});
						}else{
									opts.pic.animate({
									left:-i*opts.width
								},{
									duration:opts.runtime,
									easing: opts.easing
								});
								
							}
				},opts.triggerTime);
			},
			moveLoop:function(i){//循环滚动
				this.loop = window.setInterval(function(){
					i ++;
					i = _private.len(i);
					_private.move(i);
				},opts.moveTime);	
			},
			moveStop:function(){//停止滚动
				window.clearTimeout(this.t);
			},
			moveLoopStop:function(){//停止循环滚动
				window.clearTimeout(this.loop);
			}
		};
		return this.each(function(){
			var $this = $(this);
			//关闭
			opts.closeBut.bind("click",function(){
				_private.moveLoopStop();
				$this.hide();
				return false;
			});
			_private.imgLoad(opts.picList.find("img"),function(){
				if (opts.picList.length>1){
					if(opts.picList.find("img").css("width")>"500px"){
						opts.pic.css("top",-opts.startNum*opts.height)//设置默认位置
						}else{
							var ligeShu = opts.picList.find("img").length*300;
							opts.picList.parent().css("width",ligeShu);
							opts.picList.addClass("fl");
							opts.pic.css("left",-opts.startNum*opts.width)//设置默认位置
							}
					//opts.pic.append(opts.picList.eq(0).clone());//副本
					var html = _private.numHtml(opts.startNum),
						numList = opts.num.find("li");
					opts.num.html(html);
					_private.moveLoop(opts.startNum);
					//移进
					numList.live(opts.evn,function(){
						_private.moveLoopStop();
						_private.move($(this).index());
						
					});
					//移出
					numList.live("mouseleave",function(){
						_private.moveStop();
						_private.moveLoop(opts.startNum);
					});	
				};
			},opts.loadTime);
		});
	};
})(jQuery);
/**
 * 倒计时插件
 * example: 
 	$("p").wowotime({
		template:[
			[86400000,1], //天
			[3600000,1], //小时
			[60000,1], //分
			[1000,1], //秒
			[10,1] // 毫秒
			
		],
		interval:50,
		serverTime : +new Date(),
		setfn:function(){
			var thisDOM = arguments[0],dateArr = arguments[1]
			thisDOM.html(dateArr[0]+"天"+dateArr[1]+"小时"+dateArr[2]+"分"+dateArr[3]+"秒"+dateArr[4]+"毫秒");
		},
		callfn:function(){arguments[0].html("结束")}
	});
*/
(function($){
	$.fn.wowotime = function (options){
		var _this = $(this),tt;
		var opts = $.extend({
			template:[
				[86400000,1], //天
				[3600000,1], //小时
				[60000,1], //分
				[1000,1],//秒
				[10,1] //毫秒
			],
			serverTime : +new Date(), //服务器时间
			interval : 1000, //时间间隔
			setfn : function(){}, //回调
			callfn : function(){} //结束回调
		},options);
		var endTime = _this.attr("date-endtime"),
			lastTime = parseInt(endTime)-parseInt(opts.serverTime),
			arrTime = [];
		var countdownEvent = function(){
		   lastTime-=opts.interval;
		   if (lastTime<=0 && tt){
				window.clearTimeout(tt);
				opts.callfn(_this);
				return false;
		   };
		   var difftime = 0;
		   for(var i=0;i<opts.template.length;i++){
		   	 var day = parseInt((lastTime - difftime)/opts.template[i][0]);
			 	difftime += parseInt(day * opts.template[i][0]);
			 	arrTime[i]=(day.toString().length<2)?"0"+day:day;
		   };
		   opts.setfn(_this,arrTime);
		};
		return this.each(function(){
			tt = setInterval(countdownEvent,opts.interval);
		});
	}
})(jQuery);
/**
 * 显示隐藏 "更多"
 * $(".dhnav_list").showMoreAddress({
 * 		moreSelector:"li.dhnav_more",
 *		listSelector:"li.dhnav_hide"
 * });
*/
(function($){
	$.fn.showMoreAddress = function(options){
		var opts = $.extend({
			moreSelector:"",
			listSelector:"",
			time:0,
			isShowListSelector:"",
			isShowList:true,
			fn:function(){}
		},options);
		return this.each(function(){
			var $this = $(this),
				$evtHandle = $this.find(opts.moreSelector),
				$listSelector = $this.find(opts.listSelector),
				$isShowListSelector = $listSelector.find(opts.isShowListSelector);
			$evtHandle.click(function(){
				$listSelector.toggle(opts.time,opts.fn);
			var	$this_back = $evtHandle.css("background-position"),
				$this_back1 = $evtHandle.css("background-positionY");
			var isIE=navigator.userAgent.toUpperCase().indexOf("MSIE")==-1?false:true;
			if(isIE){
					if($this_back1 == "-50px"){
					$evtHandle.css("background-positionY","-64px");
					}else{
						$evtHandle.css("background-positionY","-50px");
						return false;
						};
				}else{
					if($this_back == "-176px -64px"){
					$evtHandle.css("background-position","-176px -50px");
					}else{
						$evtHandle.css("background-position","-176px -64px");
						}
					};
				
				
				return false;
			});
			if (opts.isShowList && $isShowListSelector.length>0){
				$evtHandle.click();
			};
		});
	};
})(jQuery);


//窝窝命名空间
var wowoTool = {};
(function($,wowoTool){
	/*
	 * 构造函数 wowoWindow
	 * 属性: 
	 * 	 id      弹出框id     必须唯一
	 * 	 width   宽          默认auto
	 * 	 height  高          默认auto
	 * 	 top     垂直位置     默认垂直居中
	 * 	 left    水平位置     默认水平居中
	 * 	 title   弹窗标题     默认为空
	 * 	 html    弹窗框架皮肤  规则在最后
	 *   $title  显示标题的DOM对象（jq）
	 *   $closeBtn 关闭按钮DOM对象（jq）
	 * 	 showFn(oThis)  显示窗口的回调函数 oThis:指向当前对象
	 * 	 hideFn(oThis)  关闭窗口的回调函数 oThis:指向当前对象
	 *   isTitle 是否显示标题 默认显示 false来阻止
	 *   isCloseBtn 是否显示关闭按钮 默认显示 false来阻止
	 * 	 isReady 是否在new的时候立即执行show方法
	 *   isLayer 是否显示遮罩层 false阻止
	 *	 zIndex  z-index
	 * 方法：
	 * 	 show()  显示弹出层
	 * 	 hide()  隐藏弹出层 
	 *   getPageWH() 返回页面的实际大小  width:getPageWH()[0] height:etPageWH()[1]
	 * 皮肤规则：{
	 * 		窗口id标识属性：date-win="windowId"
	 * 		标题标识属性 : date-win="wowoWindowTitle"
	 * 		关闭标识属性 : date-win="wowoWindowCloseBtn"
	 *}
	*/
	
	function wowoWindow(opts)
	{
		var self = this;
		self.id = opts.id; //弹出框id 必须
		self.width = opts.width;  // 宽
		self.height = opts.height;// 高
		self.top = opts.top; //X 位置
		self.left = opts.left; //Y 位置
		self.title = opts.title || ""; //标题
		self.html = opts.html || "<div class=\"tabchu\" date-win=\"windowId\"><div class=\"tanchu_title yahei clearfix\"><em date-win=\"wowoWindowTitle\"></em> <a href=\"#\" class=\"bh close_tana\" title=\"关闭\" date-win=\"wowoWindowCloseBtn\">关闭</a></div></div>"; //内容html
		self.zIndex = opts.zIndex || 1000000;
		self.showFn = opts.showFn || function(){}; //显示回调
		self.hideFn = opts.hideFn || function(){}; //关闭回调
		self.isTitle = (opts.isTitle==false)?opts.isTitle:true;
		self.isCloseBtn = (opts.isCloseBtn==false)?opts.isCloseBtn:true;
		self.isReady = (opts.isReady==false)?opts.isReady:true; //是否立即执行
		self.isLayer = (opts.isLayer==false)?opts.isLayer:true;
		self.divLayer = '<div id="wowoDivLayer" style="background:#000000;opacity:0.2; filter:alpha(opacity=20); position:absolute; left:0; top:0; display:none;"><iframe style="width:100%; height:100%; filter:alpha(opacity=0); opacity:0; background:#FFFFFF; border:0" src="about:blank"></iframe></div>';
		self.isReady && self.show();
		
	};
	wowoWindow.prototype = {
		show:function(){ //显示方法
			var that = this;
			var html = that.html.split("date-win=\"windowId\"");
				html = html[0]+"id=\""+that.id+"\""+html[1];
			that.$DOM = $("#"+that.id);
			that.$divLayer = $("#wowoDivLayer");
			
			if (that.$divLayer.length==0){
				$("body").append(that.divLayer);
				var WH = that.getPageWH();
				that.$divLayer = $("#wowoDivLayer").css({"width":WH[0],"height":WH[1],"z-index":that.zIndex - 1});
			};
			if (that.$DOM.length==0){
				$("body").append(html);
				that.$DOM = $("#"+that.id);
				that.showFn(that); //回调
			};
			that.$title = that.$DOM.find("[date-win='wowoWindowTitle']");
			that.$closeBtn = that.$DOM.find("[date-win='wowoWindowCloseBtn']");
			(that.isTitle) && that.$title.html(that.title) || that.$title.hide();
			(that.isCloseBtn) && that.$closeBtn.html(that.title) || that.$closeBtn.hide();
			that.$DOM.css({"width":that.width,"height":that.height,"z-index":that.zIndex});
			var $top = that.top || ($(window).outerHeight() - that.$DOM.outerHeight()) / 2;
			var $left = that.left || ($(window).outerWidth() - that.$DOM.outerWidth()) / 2;			
			that.$DOM.ieFixed({x:$left,y:$top});
			that.$closeBtn.off("click"); //避免多次绑定
			that.$closeBtn.click(function(){ //委派注册关闭事件
				that.hide();
				return false;
			});
			$(window).resize(function(){
				var WH = that.getPageWH();
				that.$divLayer = $("#wowoDivLayer").css({"width":WH[0],"height":WH[1],"z-index":that.zIndex - 1});
			});
			(that.isLayer) && that.$divLayer.show();
			that.$DOM.show();
		},
		hide:function(){//关闭方法
			var that = this;
			that.hideFn(that); //回调
			that.$divLayer.hide()
			that.$DOM.hide();
		},
		getPageWH : function(){
			var doc = document.documentElement,PageWH = [];
			PageWH[0] = (doc.scrollWidth>doc.clientWidth)?doc.scrollWidth:doc.clientWidth;//如果滚动条的宽度大于页面的宽度，取得滚动条的宽度，否则取页面宽度
			PageWH[1] = (doc.scrollHeight>doc.clientHeight)?doc.scrollHeight:doc.clientHeight;//如果滚动条的高度大于页面的高度，取得滚动条的高度，否则取高度
			return PageWH;
		}
	};
	wowoTool.wowoWindow = wowoWindow; //注册到wowoTool
})(jQuery,wowoTool)